home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5881 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.5 KB

  1. Path: newshost.lanl.gov!tanmoy
  2. From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: accessing structures (newbie question)
  5. Date: 21 Feb 1996 15:31:16 GMT
  6. Organization: Los Alamos National Laboratory
  7. Message-ID: <TANMOY.96Feb21083116@qcd.lanl.gov>
  8. References: <4g8gic$o6u@news1.sunbelt.net> <3128FA60.5227@metagen.co.uk>
  9.     <TANMOY.96Feb19090845@qcd.lanl.gov> <4geju0$sif@maureen.teleport.com>
  10. NNTP-Posting-Host: qcd.lanl.gov
  11. Mime-Version: 1.0
  12. Content-Type: text
  13. In-reply-to: GHouck's message of 21 Feb 1996 08:08:32 GMT
  14.  
  15. In article <4geju0$sif@maureen.teleport.com> GHouck
  16. <hksys@teleport.com> writes: 
  17. <snip>
  18.    tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya) wrote:
  19.    [snip]
  20.    >What nonsense! Anything creates trouble if you do not take the time
  21.    >to understand it.
  22.    >
  23.    >   I think you may have been using the wrong syntax when you tried the array 
  24.    >   method. The xth item is given by 'photos[x].' which is equivalent to 
  25.    >   '(photos + x * sizeof(picture))->'.
  26.    >
  27.    >This is the problem!!! photos[x]. is always the same as (photos + x)->
  28.    >In fact, this is such a basic fact of pointer arithmetic that anyone
  29.    >who posts such nonsense must surely be trying to deliberately mislead
  30.    >newbies. We have enough confusion here: please refrain from posting
  31.    >_answers_ unless you know at least the basics of C! 
  32.    >
  33.    Tanmoy,
  34.  
  35.    Speaking of nonsense (your word), what is the meaning of your statement:
  36.  
  37.    >   '(photos + x * sizeof(picture))->'.  ?
  38.  
  39.    It may make sense conceptually, but syntactically you will step thru
  40.    the array of structures rather quickly (by a factor of sizeof(picture)).
  41.    Unless I'm mistaken, did you not mean:
  42.    >    '(photos+x)->' ?
  43.    To use your cordial words:  'We have enough confusion here: please refrain
  44.    from posting _answers_ unless you know at least the basics of C!'
  45.  
  46.    Yours, Geoff Houck
  47.  
  48. If you can't distinguish a quote from a comment, please read a few
  49. more days before posting. It will help you not to make a fool of
  50. yourself. Your confusion certainly does not help dispell the confusion
  51. around.
  52.  
  53. Cheers
  54. Tanmoy
  55. --
  56. tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
  57. Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
  58. Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
  59. <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
  60. internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
  61. fax: 1 (505) 665 3003   voice: 1 (505) 665 4733    [ Home: 1 (505) 662 5596 ]
  62.